package com.bestdo;

import java.awt.Color;
import java.awt.Font;
import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;

public class PosterGenUtil {

	public static String KAJ_BASE_IMG = "/res/img/poster/kja_base_img.png";

	/**
	 * 磁盘相对目录
	 * 
	 * @param pid
	 * @return
	 */
	public static String genTempPath() {
		Date date = new Date();
		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMM" + File.separator + "dd" + File.separator);
		String dateStr = sdf.format(date);
		return File.separator + dateStr;
	}

	public static void genFilePath(String path) {
		File file = new File(path);
		if (!file.exists()) {
			file.mkdirs();
		}
	}

	public static void kjaShare(String nickName, int task, int day) {

		// 图片大小
		ImageUtil image = new ImageUtil(750, 1350);
		// 大背景图
		String bbbPath = "./kja_base_img.png";
		ImageUtil bbb = new ImageUtil(bbbPath);
		image.combineWithPicture(bbb);
		// 用户昵称
		Color color = new Color(247, 244, 166);
		image.addString(nickName, color, new Font("宋体", Font.PLAIN, 34), 182, 28);

		image.addString("" + task, Color.WHITE, new Font("宋体", Font.PLAIN, 50), 146, 85);

		image.addString("" + day, Color.WHITE, new Font("宋体", Font.PLAIN, 50), 550, 85);

		image.saveAs("./bb.png");

	}

	public static void main(String[] args) {
		PosterGenUtil.kjaShare("~(｡≧з≦)ﾉ⌒☆星星☆", 8, 5);
	}
}
